'use strict'

define([ 'jquery', 'bootstrap', 'shiftform', 'validate',
    'validate.en'], function($) {
  return {
    init : function() {
      
      this.initPage();
      
    },
    
    initPage : function() {
      
      $(".Effectiveness").each(function() {
        /*$(this).find("textarea").height($(this).height())*/
      })
            
      $('.practice-option').click(function() {
        var that = this
        
        var qualify = $(this).data("qualify");
        var score = $(this).data("option");
        $(this).parents("tr").find(".score").empty().append("<span>" + score + "</span>");
        $(this).parents("tr").find("td").removeClass("color-level");
        $(this).parents("td").toggleClass("color-level");
        
        var qualifyName = 'qualify' + qualify + 'Score';
        $('input[name="' + qualifyName + '"]').val(score);
        $('.qualify' + qualify).each(function() {
          if(that != this) {
            $(this).removeClass("color-level");
          }
        })
      })
    }

  }
})
